home *** CD-ROM | disk | FTP | other *** search
- .he (Copyright 1985 Mark Johnson) Page #
- TurboDraw
- User Manual
-
- TurboDraw has been designed to simplify the task of writing
- report and screen layouts for the Pascal programmer. This is
- done by interpreting an input screen generated by a word
- processor or editor into Pascal data and code statements that can
- be included into the users program. For simple tasks such as
- file inquiry or screen entry, little extra code need be written
- by the user to produce a clear, error free program.
-
- System Requirements
-
- TurboDraw is designed to run on any IBM PC or true compatible
- system. The program will support either an IBM color card, or an
- IBM monochrome card. Of course Turbo Pascal is required to
- compile the output of this program. To compile TurboDraw itself,
- you must have at least version 2.00 of Turbo Pascal.
-
- ACKNOWLEGMENTS
-
- TurboDraw was written by Mark Johnson of MicroTools Co. There
- are several routines worthy of mention that I borrowed from other
- public domain software. Thanks go to:
-
- Kurt M. Gutzmann - For the pull-down menu routines. One of the
- most flexible and well designed 'window' tools I've ever seen.
- It will be well worth the time for any programmer using Turbo to
- study, and use these routines.
-
- John Friel and the Forbin Project - For clean, easy to use Window
- Routines. One look at QMODEM 2.0, and you can tell that these
- guys know how to program.
-
- Although this program is written specifically for the IBM PC,
- there are versions to run under MS-DOS, CP/M, CP/M-86, and NCR
- ITX Pascal. Other versions for other languages include:
-
- CDRAW For Unix C
- CODRAW For MicroSoft and Ryan-Mcfarland COBOL
- PLIDRAW For PL/I subset G
- BASDRAW For (Ugh) basic
- NCRDRAW For NCR NEAT/3
-
- The above programs are available for a small fee.
-
-
- Mark Johnson
- 2272-F Benson Avenue
- St. Paul, MN 55116
- (612)-698-3686
- .pa
- FILES ON THIS DISK
-
- TD3.PAS - Source code for TurboDraw, in Turbo Pascal
- TEST.SCR - Sample SCREEN input file
- MANUAL.TD3 - This manual.
- TD.LIB - Library file for TurboDraw programs
-
-
-
- Preparing input for TurboDraw
-
- This section will show you how to prepare the required input for
- TurboDraw. We will use a program exercise that accesses an
- indexed inventory file for screen inquiry. The format of the
- screen is shown in Figure 2.1. The bottom line of the screen
- requests an item number from the operator, which will be used as
- a key to access the detail record from an indexed file. Once the
- record is accessed, the required information is displayed on the
- CRT. After the information is presented on the CRT, the program
- will loop back to the beginning, allowing the operator to enter
- another item number.
-
- (figure 2.1 DEMO.OUT)
-
- INVENTORY INQUIRY
-
-
- ITEM DESCRIPTION ORDERING
-
- Item number 188144 On Order 4200
- Item Name Murphy's Catsup Case Cost 29.50
- Size 16Oz List 49.95
- Class 05
-
-
- WAREHOUSE INFO HISTORY
- Cases Bots
-
- Quan Cases 2314 MTD 765 24
- Bottles 10 YTD 4341 546
-
- Case Location 123-08
- Bottles 910-08
-
-
-
-
- Enter Item Number ( 0 to end ): 188144
- .pa
-
- Creating the SCREEN INPUT FILE
-
- The SCREEN input file is a 'picture' of what you want displayed
- on the crt screen. The SCREEN file consists of up to 24 lines of
- 80 characters. Each line is composed of one or more LITERALS
- and/or VARIABLES. Each variable is preceded by an exclamation
- mark (!) or a crosshatch (#). The exclamation mark indicates
- that its associated variable is an output variable, and the
- crosshatch indicates an input variable. Variables may be up to
- 64 characters long, with no embedded spaces. Shown in figure 2.2
- is the SCREEN file ready for use by TurboDraw. It was prepared
- with Wordstar ( A popular word processor).
-
-
- (figure 2.2 DEMO.SCR)
-
- INVENTORY INQUIRY
-
-
- ITEM DESCRIPTION ORDERING
-
- Item number !item On Order !ionorder
- Item Name !iname Case Cost !icost
- Size !isize List !ilist
- Class !iclass
-
-
- WAREHOUSE INFO HISTORY
- Cases Bots
-
- Quan Cases !icases MTD !imtdcs !imtdbt
- Bottles !ibottles YTD !iytdcs !iytdbt
-
- Case Location !icsloc
- Bottles !ibtloc
-
-
-
-
- Enter Item Number ( 0 to end ): #item
- .pa
- Running TurboDraw
-
- When executed, TurboDraw shows the SETUP MENU, which allows the
- user to specify several options and input/output file names.
-
- The menu is a 'Pull-down' menu based on those designed by Xerox,
- and later claimed as proprietary by Apple Computer. To select
- options, simply move the cursor sideways to a major option, then
- vertically to select the minor option.
-
- Shown below in figure 3.1 is the SETUP MENU. Refer to this menu
- as we discuss the following section.
-
- (Figure 3.1)
- CONTINUE INPUT OUTPUT LIBRARY
- ------------------------------------------------------------------------
- next menu screen file pascal file library file
-
-
-
-
-
- Screen file name DEMO.SCR
- Generated program name DEMO.PAS
- Library File Name TD.LIB
-
-
-
-
-
- (end of figure 3.1)
-
-
- SETUP MENU
-
- Run time options
-
- SCREEN FILE NAME - This defines the name of the file that you
- created that contains the screen definitions.
-
- GENERATED PROGRAM NAME - The name of the generated pascal
- program that will be created by TurboDraw.
-
- LIBRARY FILE NAME - This file will be included in the
- beginning of the generated Pascal program.
-
- CONTINUE - Select this option after you have selected the
- screen file name and the pascal output file name. TurboDraw will
- open the files and proceed to the MAIN MENU if the files have
- been opened successfully, otherwise it will let you re-enter the
- offending file name.
- .pa
- (figure 3.2 MAIN MENU)
-
- COMMANDS OPTIONS
- ------------------------------------------------------------------------
- setup menu library?
- sort defs procedure?
- generate variables?
-
-
- MAIN MENU
-
-
-
- Include Library Functions No
- Generate a Procedure Yes (test_print)
- Include VAR Definitions Yes
-
-
-
- (end of figure 3.2)
-
-
- The following options are valid for the MAIN MENU
-
- OPTIONS
-
- LIBRARY? - Selecting this option will toggle a yes/no switch. If
- you select YES, then a library of I/O functions will be included
- in the generated program. These functions are used by the
- generated Pascal program for input of integer and real numbers.
-
- PROCEDURE? - Selecting this option will toggle a yes/no switch.
- If you select YES, then the generated Pascal code will be
- formatted as a procedure, otherwise the output will be designed
- to be inline code that will become PART of a procedure or main
- program that you write.
-
- VARIABLES? - Selecting this option will toggle a yes/no switch.
- If you select YES, then TurboDraw will create declarations for
- the variables used in the output code.
-
- .pa
-
- COMMANDS
- SETUP MENU - Before TurboDraw can generate the Pascal program, it
- needs some information about the variables in the screen file.
- TurboDraw needs to know the length and number of decimal places
- of each variable. See the Section SETUP MENU for more
- information on setting up variables.
-
-
- SORT DEFS - This feature allows you to change the order in which
- items are displayed on the screen. See the Section SORTING
- DEFININITIONS for more information.
-
-
- GENERATE - When the variable declarations are done, you will
- return to the main menu. You can alter or examine the variable
- declarations by selecting option V again, or generate the Pascal
- program by selecting this option. The finished output from
- TurboDraw is shown in figure 3.5.
-
-
- .pa
- SETUP MENU
-
- This menu is the heart of the entire TurboDraw system. In this
- menu, you define the length, type, and color of each variable on
- the screen. Refer to figure 3.4 as we discuss the features of
- the setup menu.
-
- Below the menu bar is an image of the screen output as TurboDraw
- sees it. Numeric variables are displayed as Nines, and
- Alphanumeric variables are displayed as X's. Using the menu, you
- can step through the variables and change their attributes, and
- as you do, the screen will change to reflect your changes. Let's
- go through the options one by one:
-
- FILE OPERATIONS
-
- Next Item - Selecting this will cause the next field on the
- screen to begin flashing. At this point, any changes will be made
- to the flashing field.
-
- Main Menu - Selecting this option will return you to the main
- menu.
-
- TYPE OPERATIONS
-
- Alpha - Selecting this option will cause the blinking field to
- show as X's, and indicates to TurboDraw that it is an
- ALPHANUMERIC field.
-
- Numeric - Selecting this option will cause the blinking field to
- show as 9's, and indicates a NUMERIC field.
- .pa
- SIZE OPERATIONS
-
- Length - Valid for alpha and numeric fields. The length of each
- field is specified initially by the number of characters in the
- fields' name. You can change it to any value greater than or
- equal to zero. For numeric fields, you may also want to specify
- the SCALE of the field (see below).
-
- Scale - The scale of a numeric field is the number of digits
- beyond the decimal point. Thus, the maximum value that can be
- held in a variable of LENGTH 7 and SCALE 2 is 99999.99, And in
- Pascal, it would be displayed with a WRITE(variable:7:2)
- statement.
-
- EXAMPLE
-
- Using the SETUP menu, change the 'item name' field to an
- alphanumeric field of length 15.
-
- STEP 1. Select 'next item' from the menu bar twice by
- pressing the return key until the 'item name' field is
- flashing.
-
- STEP 2. Press the right arrow key to move the bar to the
- 'TYPE' bar in the menu. Press the return key to select 'alpha'
-
- STEP 3. Press the right arrow twice to the 'SIZE' bar, and press
- return to select 'LENGTH'. You will be prompted for the length
- of the field. Enter 15.
-
- STEP 4. If you want to change the color of the field, select the
- 'COLOR' bar and press return. Now another menu, the COLOR MENU
- will be shown, Move the bar around until you see a color you
- like, and press return to select that color. To return to the
- SETUP menu, select the 'last menu' option.
-
- (NOTE - If you have a monochrome card in your PC, then most of
- the colors will show as white, or underlined, or blinking
- characters, or combinations.)
-
- .pa
- (figure 3.4)
-
- FILE TYPE SIZE COLOR
- ------------------------------------------------------------------------
- next item alpha length next menu
- main menu numeric scale
-
-
- INVENTORY INQUIRY
-
-
- ITEM DESCRIPTION ORDERING
-
- Item number 999999 On Order 999999
- Item Name 9999 Case Cost 999999
- Size 9999 List 999999
- Class 999999
-
-
- WAREHOUSE INFO HISTORY
- Cases Bots
-
- Quan Cases 999999 MTD 999999 999999
- Bottles 999999 YTD 999999 999999
-
- Case Location 99999
- Bottles 99999
-
-
- Enter Item Number ( 0 to end ): 9999
- .pa
-
- SORTING DEFINITIONS
-
- SORT - This feature allows you to change the order in which
- items are displayed on the screen. For example you may want an
- input field on the bottom of the screen to be completed before
- displaying another field near the top of the screen.
-
- When you select this option, you will be shown a list of all
- literals and variables that have been accepted by TurboDraw.
- Each entry will have a line number associated with it, in
- increments of 10. TurboDraw will ask you for the line number of
- the item you wish to move, and the destination line number you
- wish to move it to. Don't enter an existing number for the
- destination, or you will lose the field that was referenced by
- that number. When you are done moving items, enter '999' to
- return to the main menu.
- .pa
- (figure 3.5 DEMO.PAS ) { My comments are in UPPER CASE }
-
- { Start of Turbodraw code }
- Var
-
- { THE FOLLOWING VARIABLE DECLARATIONS ARE INCLUDED BY SETTING THE
- 'variables?' FLAG TO Yes. }
-
- item : Integer;
- ionorder : Real;
- iname : String[0];
- icost : Real;
- isize : String[0];
- ilist : Real;
- iclass : Integer;
- icases : Integer;
- imtdcs : Real;
- imtdbt : Real;
- ibottles : Integer;
- iytdcs : Real;
- iytdbt : Real;
- icsloc : String[4];
- ibtloc : String[4];
- item : Integer; { THIS IS A DUPLICATION, THE PROGRAMMER MUST }
- { DELETE IT BEFORE COMPILING }
-
-
- Procedure prt_scrn; { PROCEDURE SELECTED AT MAIN MENU }
- Begin
- Clrscr;
- TextColor(15);
- Gotoxy(23,1);
- TextColor(15);
- Write('INVENTORY INQUIRY');
- Gotoxy(6,4);
- Write('ITEM DESCRIPTION ORDERING');
- Gotoxy(6,6);
- Write('Item number ');
- Gotoxy(19,6);
- TextColor(7);
- Write(item:6);
- Gotoxy(38,6);
- TextColor(15);
- Write('On Order ');
- Gotoxy(49,6);
- TextColor(7);
- Write(ionorder:7:2);
- Gotoxy(6,7);
- TextColor(15);
- Write('Item Name ');
- Gotoxy(19,7);
- TextColor(7);
- Write(iname);
- Gotoxy(38,7);
- TextColor(15);
- Write('Case Cost ');
- Gotoxy(49,7);
- TextColor(7);
- Write(icost:5:2);
- Gotoxy(11,8);
- TextColor(15);
- Write('Size ');
- Gotoxy(19,8);
- TextColor(7);
- Write(isize);
- Gotoxy(43,8);
- TextColor(15);
- Write('List ');
- Gotoxy(49,8);
- TextColor(7);
- Write(ilist:5:2);
- Gotoxy(11,9);
- TextColor(15);
- Write('Class ');
- Gotoxy(19,9);
- TextColor(7);
- Write(iclass:2);
- Gotoxy(6,12);
- TextColor(15);
- Write('WAREHOUSE INFO HISTORY');
- Gotoxy(44,13);
- Write('Cases Bots');
- Gotoxy(6,15);
- Write('Quan Cases ');
- Gotoxy(17,15);
- TextColor(7);
- Write(icases:6);
- Gotoxy(36,15);
- TextColor(15);
- Write('MTD ');
- Gotoxy(44,15);
- TextColor(7);
- Write(imtdcs:7:2);
- Gotoxy(57,15);
- Write(imtdbt:7:2);
- Gotoxy(6,16);
- TextColor(15);
- Write('Bottles ');
- Gotoxy(17,16);
- TextColor(7);
- Write(ibottles:6);
- Gotoxy(36,16);
- TextColor(15);
- Write('YTD ');
- Gotoxy(44,16);
- TextColor(7);
- Write(iytdcs:7:2);
- Gotoxy(57,16);
- Write(iytdbt:7:2);
- Gotoxy(2,18);
- TextColor(15);
- Write('Case Location ');
- Gotoxy(17,18);
- TextColor(7);
- Write(icsloc);
- Gotoxy(2,19);
- TextColor(15);
- Write('Bottles ');
- Gotoxy(17,19);
- TextColor(7);
- Write(ibtloc);
- Gotoxy(1,24);
- TextColor(15);
- Write('Enter Item Number ( 0 to end ): ');
- Gotoxy(34,24);
- TextColor(5);
- item:=Getint(6);
- TextColor(15);
- End;
- { End of Turbodraw Code }
-
-
- .pa
- USING TurboDraw OUTPUT
-
- Things to watch for
-
- 1) Duplicate variables - If you have two fields on the same
- screen with the same name, and you've selected the 'include VARS'
- option, then two separate declarations for the same variable will
- be included in the program. Delete one of them.
-
- 2) The total number of fields on one screen cannot exceed 80.
-
- 3) When using the SORT feature, try not to overwrite a field by
- assigning a line number that is already in use. Unpredictable
- output will result.
-
- 4) In the setup menu, you can only go forward, not backward. If
- you want to go back to change a definition, select the 'main
- menu' function, then reselect the 'Setup' option, and step down
- to the field in question.
-
-
- .pa
- Technical overview
-
- Work on TurboDraw began in 1983 with a program called
- PLIDRAW which generates screens for the PL/I language. in 1984
- several other languages were included such as NCR Neat/3, 8086
- assembler, and Pascal. In early 1985 the first version of
- TurboDraw was released. It was written in PL/I and designed to
- run on any machine capable of running PL/I Subset G. In 1985,
- TurboDraw and CODRAW (for NCR COBOL ) were translated from PL/I
- to Pascal primarily because of the portability of the Pascal
- language. Finally, in 1986 a version specifically for the IBM PC
- has been developed, This version supports full color, windows,
- sound, etc. Future versions will be available to run directly on
- mainframes supporting standard Pascal.
-
-
- How It Works
-
- SCREEN GENERATOR
-
- Once all options and files have been set up from the setup
- menu, the SCREEN file is read in line by line. Each line is
- broken up into individual components: either variables or
- literals. A literal is a character string from 1 to 132
- characters long delimited by blanks or a newline character.
- Embeded spaces are allowed. A Variable is a character string
- from 1 to 64 characters long preceded by either an exclamation
- mark, (which indicates an output variable), or a crosshatch
- (which indicates an input variable). Each variable or literal is
- stored in a table containing such information as its' type, X and
- Y coordinates, length, scale, and several other relevant
- factors. Once the entire file has been read, the MAIN MENU
- prompts the operator to enter variable declarations. It is
- necessary for the operater to enter variable declarations manually
- because this information is not contained in the SCREEN file.
-
- When all variables have been declared to the operators
- satisfaction, selecting the 'GENERATE' option starts the code
- generation phase.
-
- CODE GENERATOR
-
- If you selected the 'include variables' option, the generator
- first outputs the variables to the .PAS file.
-
- If you selected the 'Include .LIB file' option, then the
- specified library file is copied to the .PAS file. The library
- file, TD.LIB, contains routines for integer and decimal input
- with full error checking.
-
- Next, the table that was created from the SCREEN file is examined
- item by item, and the appropriate code is generated and output to
- the PAS file. If you have selected a procedure name, then the
- code will be output as a procedure, otherwise it will be
- structured as in-line code.